package LocatorsOnPages;


import Tests.TestConditions;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;


public class RegistrationPage extends TestConditions {



    /*---------------constructor---------------------------------------------------------------*/
    public RegistrationPage (WebDriver driver)
    {
        this.driver = driver;

    }

    /*---------------locators---------------------------------------------------------------*/

    private By Signin = By.name("signin");
    private By Registration = By.xpath("//div/div/div/form/div[5]/a");
    private By Title = By.name("title");
    private By Login = By.name("login");
    private By Email = By.name("email");
    private By Password = By.name("password");
    private By RegButton = By.className("button-css-green");
    private By Signout = By.name("signout");
    private By VhodButton = By.xpath("//div/div/div/form/div[4]/button");

    /*---------------end locators---------------------------------------------------------------*/


    /*---------------Actions---------------------------------------------------------------*/

    public void clickSignIn(){

        driver.findElement(Signin).click();

    }


    public void clickRegistration(){

        driver.findElement(Registration).click();

    }


    public void nameField(String text){

        if(text.equals("clear")){

            driver.findElement(Title).clear();
        }else{

            driver.findElement(Title).sendKeys(text);

        }
    }


    public void loginField(String text){

        if(text.equals("clear")){

            driver.findElement(Login).clear();
        }else{

            driver.findElement(Login).sendKeys(text);
        }
    }


    public void emailField(String text){

        if(text.equals("clear")){

            driver.findElement(Email).clear();
        }else{

            driver.findElement(Email).sendKeys(text);
        }
    }


    public void passwordField(String text){

        if(text.equals("clear")){

            driver.findElement(Password).clear();
        }else{

            driver.findElement(Password).sendKeys(text);
        }
    }


    public void clickRegButton(){

        driver.findElement(RegButton).click();

    }


    public void clickSignOut(){

        driver.findElement(Signout).click();

    }


    public void vhodButtonClick(){

        driver.findElement(VhodButton).click();

    }

     /*---------------End Actions---------------------------------------------------------------*/

}
